I am trying to convert an firebase image URL to base64 using expo FileSystem but getting following error.
[Unhandled promise rejection: Error: Location "https://pngimg.com/uploads/birds/small/birds_PNG108.png" isn't readable - Expo React Native
URL is totally fine and perfect as I can open it in browser. I am trying following URL, and tried multiple other URLs as well.
https://pngimg.com/uploads/birds/small/birds_PNG108.png
Following is my code.
import * as FileSystem from 'expo-file-system';
<TouchableOpacity onPress={async () => {
const base64 = await FileSystem.readAsStringAsync('https://pngimg.com/uploads/birds/small/birds_PNG108.png', { encoding: 'base64' });
Share.share(
{
title: 'test title',
url: item.url,
},
{
excludedActivityTypes: [
],
}
);
}}>
</TouchableOpacity>
)}
Couldn't find any solution to this problem on any forum.
Maybe you should rather use
import * as Sharing from 'expo-sharing';
Save the image temporary on disc and use the uri to share the image.
than
import { Share} from 'react-native';